feat(pagerduty): validate integration + add 9 tools for deeper API coverage#5446
Conversation
…verage - fix list tools' total field to null-default (matches PagerDuty spec, was wrong 0 default) - add pagination offset across all list tools - add incidentKey, resolution, urgencies, triggered status support - add get_incident, get_service, list_escalation_policies, list_incident_alerts, list_schedules, list_users, merge_incidents, snooze_incident tools (REST API v2) - add send_event tool (Events API v2) for trigger/acknowledge/resolve via routing key - add 2 new BlockMeta skills grounded in documented PagerDuty workflows
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Existing tools are tightened to the official API: list endpoints now expose Registry registers all new Reviewed by Cursor Bugbot for commit ab9a335. Configure here. |
Greptile SummaryThis PR significantly expands the PagerDuty integration by adding 9 new tools (
Confidence Score: 5/5Safe to merge; all changes are additive, backwards compatible, and the three previously flagged runtime issues have been correctly addressed. All 9 new tools follow established patterns with correct PagerDuty API headers, explicit runtime guards before building request bodies, and null-safe response mapping. The total-defaulting bug fix is spec-correct and non-breaking. The one remaining point (updateResolution field visibility vs. tool guard) results in a clear error message rather than silent bad data. apps/sim/blocks/blocks/pagerduty.ts — the updateResolution field condition could be tightened to match the tool's own guard, preventing a confusing runtime error when a user fills the field alongside a non-resolve status change. Important Files Changed
Sequence Diagram%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant UI as Block UI
participant Block as pagerduty.ts (Block Config)
participant RESTAPI as PagerDuty REST API v2
participant EventsAPI as PagerDuty Events API v2
Note over UI,Block: REST operations (list/get/create/update/snooze/merge)
UI->>Block: "operation != send_event, apiKey + params"
Block->>RESTAPI: "Authorization: Token token=apiKey"
Block->>RESTAPI: From: fromEmail (write ops only)
RESTAPI-->>Block: incident/service/user/policy/schedule data
Block-->>UI: Structured typed output
Note over UI,Block: send_event operation
UI->>Block: "operation = send_event, routingKey + eventAction"
Block->>EventsAPI: POST /v2/enqueue routing_key + event_action + payload
Note over Block,EventsAPI: trigger requires summary+source+severity
Note over Block,EventsAPI: acknowledge/resolve require dedupKey
EventsAPI-->>Block: status + message + dedup_key
Block-->>UI: status + message + dedupKey
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant UI as Block UI
participant Block as pagerduty.ts (Block Config)
participant RESTAPI as PagerDuty REST API v2
participant EventsAPI as PagerDuty Events API v2
Note over UI,Block: REST operations (list/get/create/update/snooze/merge)
UI->>Block: "operation != send_event, apiKey + params"
Block->>RESTAPI: "Authorization: Token token=apiKey"
Block->>RESTAPI: From: fromEmail (write ops only)
RESTAPI-->>Block: incident/service/user/policy/schedule data
Block-->>UI: Structured typed output
Note over UI,Block: send_event operation
UI->>Block: "operation = send_event, routingKey + eventAction"
Block->>EventsAPI: POST /v2/enqueue routing_key + event_action + payload
Note over Block,EventsAPI: trigger requires summary+source+severity
Note over Block,EventsAPI: acknowledge/resolve require dedupKey
EventsAPI-->>Block: status + message + dedup_key
Block-->>UI: status + message + dedupKey
Reviews (5): Last reviewed commit: "docs(pagerduty): mention triggered as a ..." | Re-trigger Greptile |
…lidation - match required condition to visibility condition for eventSummary/eventSource (trigger-only) - validate trigger payload has summary/source/severity before sending, throw descriptive error - validate snooze duration is finite and within PagerDuty's 1-604800 range - drop empty segments when splitting merge source incident IDs
|
@greptile review |
|
@cursor review |
… integer snooze duration - merge_incidents: throw if source_incidents ends up empty after filtering blanks - send_event: require dedupKey for acknowledge/resolve to match block's required condition - snooze_incident: require an integer duration, not just a finite number
|
@greptile review |
|
@cursor review |
PagerDuty only accepts an incident's resolution field when status is being set to resolved in the same request; sending it otherwise gets rejected by the API with an opaque error.
|
@greptile review |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 8d6d341. Configure here.
|
@greptile review |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit ab9a335. Configure here.
Summary
totalto0instead ofnull(PagerDuty only returnstotalwhen explicitly requested)offsetsupport across all list toolsincidentKey/incident_keyon create,resolutionon update/resolve,urgencies[]filter on list,triggeredstatus optionget_incident,get_service,list_escalation_policies,list_incident_alerts,list_schedules,list_users,merge_incidents,snooze_incident(REST API v2), andsend_event(Events API v2 — trigger/acknowledge/resolve via routing key)Type of Change
Testing
bun run lintclean,bun run type-checkclean (sim package), vitest block/tool tests passChecklist